var item = document.querySelectorAll('.item')

document.addEventListener('scroll',dong)
function dong(){
    
    if (document.documentElement.scrollTop >= 450) {
        
        item.forEach(function (el) {
            var tree = el.querySelector('.tree')
            var treeBody = tree.children[0]
            var percent = parseInt(tree.children[1].innerText) / 100
            
            var timer = setInterval(function () {
                var w = parseInt(getComputedStyle(treeBody).width)
                if (w < tree.offsetWidth * percent - 5)
                    treeBody.style.width = w + 5 + 'px'
                else{
                    treeBody.style.width = tree.offsetWidth * percent + 'px'
                    clearInterval(timer)
                    
                }
            }, 16)
        })
        document.removeEventListener('scroll',dong)
        console.log(1)
    
    }
}